Skip to content

Cardano Pythathon: Factura Ya — Invoice Factoring Marketplace#97

Open
qmarquez wants to merge 8 commits intopyth-network:mainfrom
qmarquez:cardano-factura-ya
Open

Cardano Pythathon: Factura Ya — Invoice Factoring Marketplace#97
qmarquez wants to merge 8 commits intopyth-network:mainfrom
qmarquez:cardano-factura-ya

Conversation

@qmarquez
Copy link

Pyth Examples Contribution

Team Name: Facturas Ya
Submission Name: Factura Ya
Team Members: Dario Fasolino, Macarena Carabajal
Contact: dario.a.fasolino@gmail.com, macacarabajal3@gmail.com

Type of Contribution

  • New Example Project (Adding a new example to demonstrate Pyth integration)
  • Bug Fix (Fixing an issue in existing examples)
  • Documentation Update (Improving README, comments, or guides)
  • Enhancement (Improving existing functionality or adding features)
  • Hackathon Submission (Submitting a project from a hackathon)

Project Information

Project/Example Name: Factura Ya

Pyth Product Used:

  • Pyth Price Feeds
  • Pyth Entropy
  • Multiple Products
  • Other: ___________

Blockchain/Platform:

  • Cardano
  • Ethereum/EVM
  • Solana
  • Aptos
  • Sui
  • Fuel
  • Starknet
  • TON
  • Other: ___________

Description

What does this contribution do?

Factura Ya is an on-chain invoice factoring marketplace built on Cardano. Latin American SMEs tokenize their outstanding invoices as NFTs, deposit collateral as a good-faith guarantee, and sell the collection rights to investors at a discount. The SME gets paid immediately; the investor collects the full amount at maturity.

How does it integrate with Pyth?

Pyth is central to the entire valuation pipeline:

  • On-chain (Aiken): pyth_oracle.ak calls pyth.get_updates() to read the verified ADA/USD price feed (feed ID 16) from the Pyth withdraw-script redeemer. Price freshness is enforced (max 60s). usd_to_lovelace() converts invoice values using the real-time price.
  • Marketplace listing: When an invoice is listed, the current Pyth price is snapshotted into the listing datum as a reference for investors.
  • Off-chain (TypeScript): PythPriceClient subscribes to Pyth Pro WebSocket for live updates. Transaction construction uses @pythnetwork/pyth-lazer-cardano-js (getPythState(), getPythScriptHash()) with the PreProd Policy ID d799d287105dea9377cdf9ea8502a83d2b9eb2d2050a8aea800a21e6.

What problem does it solve or demonstrate?

SMEs in Argentina wait 60-90 days to collect on invoices. Traditional factoring charges 3-5% monthly. Factura Ya enables instant liquidity through on-chain invoice tokenization with transparent pricing powered by Pyth oracles — no banks, no intermediaries.

Architecture

  • 3 Aiken validators: invoice_mint (NFT minting policy), escrow (collateral lock/release/forfeit), marketplace (list/purchase/delist)
  • Pyth oracle module: price feed consumer with freshness validation + USD-to-lovelace conversion
  • Off-chain: TypeScript tx builders using Evolution SDK + Pyth Cardano JS SDK
  • Indexer: Oura (TxPipe) pipeline + Express REST API
  • Frontend: React + Vite with CIP-30 wallet connection (Nami/Eternl/Lace)
  • 32 Aiken tests passing

Testing & Verification

Prerequisites

  • Aiken v1.1.21+
  • Node.js 18+
  • Pyth API key

Setup & Run Instructions

cd lazer/cardano/factura-ya

# Run indexer
cd indexer && npm install && npm start

# Run frontend
cd frontend && npm install && npm run dev

Deployment Information

Target network: Cardano PreProd
Pyth Policy ID: d799d287105dea9377cdf9ea8502a83d2b9eb2d2050a8aea800a21e6

Checklist

Code Quality

  • Code follows existing patterns in the repository
  • Proper error handling implemented
  • No hardcoded values (use environment variables where appropriate)

Testing

  • Tested locally and works as expected
  • All existing functionality still works (no breaking changes)

Notes for Reviewers

Hackathon submission for the Cardano Pythathon (2026-03-22). This creates the first lazer/cardano/ directory in the repo.

qmarquez and others added 8 commits March 22, 2026 11:34
Hackathon submission for the Cardano Pythathon.

Factura Ya is an on-chain invoice factoring marketplace on Cardano.
SMEs tokenize outstanding invoices as NFTs, deposit collateral, and
sell collection rights to investors at a discount. Pyth's ADA/USD
price feed provides real-time currency conversion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant